package com.zzzyh.bookbackgroundsystem.enums;

public enum BookStatusEnum {
    NORMAL(1, "正常"),
    LOST(2, "在馆丢失"),
    BORROWED(3, "借出"),
    LOST_BORROWED(4, "借出丢失"),
    DELETED(5, "已删除");


    private Integer code;
    private String message;

    BookStatusEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public static BookStatusEnum getBookStatusEnum(Integer code) {
        for (BookStatusEnum bookStatusEnum : BookStatusEnum.values()) {
            if (bookStatusEnum.getCode().equals(code)) {
                return bookStatusEnum;
            }
        }
        return null;
    }
}
